<template>
  <div style="width:100%; height:100%;">
     <div class="home">
   <div class="solid">
     <ul>
       <li @click="show(item.id)" v-for="item in toplist" :key="item.id" :class="{active:cateid==item.id}">
          <span> {{item.name}}</span>
         </li>
     </ul>
   </div>
     

     <div class="boxcen">
       <ul>
         <li v-for="ins in boxlist" :key="ins.id" @click="bomshow(ins.id)" :class="{she:claid==ins.id}">
            <span>{{ins.name}}</span>
         </li>
       </ul>
     </div>
      

      <div class="bombox">
        <ul>
          <li  v-for="end in bomlist" :key="end.id" @click="bomstall(end.id,end.name)" :class="{bomcas:bomid==end.id}">
            <span>{{end.name}}</span>
          </li>
        </ul>
      </div>
      </div>
      <div class="bomtext">
         &nbsp;&nbsp;&nbsp;&nbsp;亲,根据平台管控及行业的要求,部分类目不支持无线发布。若没有找到正确的类目,请到网页端卖家中心进行商品发布。
      </div>
  </div>
 
</template>

<script>
import { Switch } from "mint-ui";

export default {
  components: {
    [Switch.name]: Switch,
  },
  data() {
    return {
      hide: 1,
      level: 1,
      toplist: "",
      cateid:1,
      boxlist:'',
      bomlist:'',
      claid:1,
      bomid:1,
      goodsid:'',
      companyid:'',
    };
  },
  mounted() {
    this.info();
    // this.show()
    // this.bomshow()
  },
  methods: {
    
    info() {
      this.goodsid=this.$route.query.goodsid
      console.log(this.goodsid)
      this.companyid=this.$route.query.companyid
      this.$http
        .get(this.APIURL_PREFIX + "/api/wap/categorys", {
          params: { level: this.level }
        })
        .then(response => {
          console.log(response);
          this.toplist = response.data.data;
          
        });
    },
    show(ind) {
      this.cateid=ind
         console.log(this.cateid,ind) 
        this.$http
        .get(this.APIURL_PREFIX + "/api/wap/categorys", {
          params: { level: this.level+1, parentId:ind}
        })
        .then(response=>{
           
            this.boxlist=response.data.data
            console.log(this.boxlist)
        })
    },
    bomshow(id){
      
          console.log(id)
      this.claid=id
        this.bomins=true
             this.$http
        .get(this.APIURL_PREFIX + "/api/wap/categorys", {
          params: { level: this.level+2, parentId:id}
        })
        .then(response=>{
            console.log(response)
            this.bomlist=response.data.data
        })
     
     
    },
    bomstall(id,name){
      console.log(id,name)
      this.bomid=id
      this.$router.push({path: "me_newgoods", query: {lmid:id, lmname: name,companyid:this.companyid,}});
    }
   
  }
};
</script>

<style scoped>
@import "../../assets/personal/css/me_leimu.css";
</style>
